package com.borya.action.mobile;

import org.apache.log4j.Logger;

import com.alibaba.fastjson.JSONObject;
import com.borya.action.BaseAction;
import com.borya.framework.annotation.Action;
import com.borya.framework.annotation.Autowired;
import com.borya.framework.annotation.JsonResult;
import com.borya.framework.annotation.UrlMapping;
import com.borya.framework.core.ServerRequest;
import com.borya.framework.core.ServerResponse;
import com.borya.service.mobile.SdkAppService;

/**
 * rxg 2020-3-20 单点结算app SDK登录接口
 * 
 * @author borya
 */
@UrlMapping("/c/sdkApp/")
@Action
public class SdkAppAction extends BaseAction {

	private Logger log = Logger.getLogger(getClass());

	@Autowired("sdkAppServiceImpl")
	private SdkAppService sdkAppService;

	@UrlMapping("getLoginCode")
	@JsonResult
	public String getLoginCode(ServerRequest request, ServerResponse response) {
		JSONObject json = getJson(request);
		String result = sdkAppService.getLoginCode(json, request);
		log.info("INFO[" + json + "],OUT[" + result + "]");
		return result;
	}

	@UrlMapping("login")
	@JsonResult
	public String login(ServerRequest request, ServerResponse response) {
		JSONObject json = getJson(request);
		String result = sdkAppService.login(json, request);
		log.info("INFO[" + json + "],OUT[" + result + "]");
		return result;
	}

	@UrlMapping("livingPre")
	@JsonResult
	public String livingPre(ServerRequest request, ServerResponse response) {
		JSONObject json = getJson(request);
		String result = sdkAppService.livingPre(json, request);
		log.info("INFO[" + json + "],OUT[" + result + "]");
		return result;
	}
}
